A finite state machine (FSM) is a device that stores the status of something at a given time and operates on input to change the status and/or cause an action or output to take place based on the input. An FSM is typically implemented in either hardware or software, or a combination of the two. An example of a hardware implementation is a digital logic circuit that controls the operation of a vending machine. Putting the right amount of money into the machine and pressing a button causes an item to be vended and change returned if required. The digital logic circuit can be implemented entirely in hardware using logic chips and circuits. An example of a software implementation for a vending machine is a microcontroller that is programmed to detect inputs, such as how much money is deposited and which buttons are pushed, and provide an output to control the release of a product and provide change. In either implementation, the design process starts with designing an FSM that shows all the possible states of the process along with the inputs and outputs of each state.
A computer or other programmable device is a state machine in which each machine instruction causes the status of the device to move from one state to another. In general, a programmer develops a state machine diagram and then writes specific software to implement the FSM corresponding to that design. A design change requires new software to implement the new FSM corresponding to the changed design.